<template>
  <main class="main">
    <div class="top">
      <div class="left">
        <!-- <img src="../assets/image/logo.png" alt="" /> -->
        <span class="title">工作台</span>
      </div>
      <div class="right">
        <!-- <div>当前版本：试用版本（2024-05-03 00:00到期）</div>
        <div class="item">
          <el-icon><Message /></el-icon>
          <span>消息</span>
        </div>
        <div>
          <el-icon><Edit /></el-icon>
          <span>编辑资料</span>
        </div>
        <el-icon><ArrowDown /></el-icon> -->
        <el-popover placement="bottom" title="" :width="150" trigger="click">
          <template #reference>
            <div class="right">
              <img src="../assets/image/headImg.png" alt="" />
              <span>{{ nickName }}</span>
              <el-icon><ArrowDown /></el-icon>
            </div>
          </template>
          <el-button style="width: 100%" @click="layout">退出登录</el-button>
        </el-popover>
      </div>
    </div>
  </main>
</template>

<script lang="ts" setup>
import router from '../router'
import { ref, watch } from 'vue'
import { useCommonStore } from '@/stores/common'
const currentRoute = ref('')
const nickName =
  JSON.parse(sessionStorage.getItem('userInfo') as string)?.nickName || '杭州微未01用户'
watch(
  () => router.currentRoute.value,
  (toPath) => {
    currentRoute.value = toPath.path
  },
  { immediate: true, deep: true }
)
const layout = () => {
  sessionStorage.clear()
  useCommonStore().setBreadcrumbsList([])
  router.push('/login')
}
</script>

<style scoped lang="less">
.main {
  background: url('../assets/image/lsdht.png') no-repeat;
  padding: 7px 36px;
  background-size: cover;
  .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left {
      display: flex;
      align-items: center;
      img {
        width: 50px;
        height: 46px;
      }
      .title {
        color: var(--vt-c-white-soft);
        margin-left: 26px;
        font-size: 22px;
        font-weight: 500;
        font-family: Alibaba-PuHuiTi, Alibaba-PuHuiTi;
        line-height: 27px;
      }
    }
    .right {
      display: flex;
      align-items: center;
      cursor: pointer;
      color: #fff;
      font-size: 15px;
      font-family:
        PingFangSC,
        PingFang SC;
      font-weight: 500;
      line-height: 21px;
      .item {
        display: flex;
        align-items: center;
        margin: 0 40px;
      }
      span {
        margin: 0 5px;
      }
      img {
        width: 26px;
        height: 26px;
        margin-left: 20px;
        margin-right: 5px;
      }
    }
  }
}
</style>
